package com.dwxt.mall.admin.service;

import com.dwxt.mall.dao.PromotionProductMapper;
import com.dwxt.mall.entity.PromotionProduct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class PromotionServiceAdmin {
    @Autowired
    private PromotionProductMapper promotionProductMapper;

    public void createOrUpdate(PromotionProduct promotionProduct) {
        if (promotionProduct.getId() == null) {
            promotionProductMapper.insertSelective(promotionProduct);
        } else {
            promotionProductMapper.updateByPrimaryKeySelective(promotionProduct);
        }
    }

    public void delete(Integer id) {
        promotionProductMapper.deleteByPrimaryKey(id);
    }
}
